home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume25 / rcs-5.6 / part09 < prev    next >
Encoding:
Text File  |  1991-12-19  |  57.8 KB  |  1,573 lines

  1. Newsgroups: comp.sources.unix
  2. From: hammer@cs.purdue.edu (Adam Hammer)
  3. Subject: v25i085: rcs-5.6 - Revision Control System, V5.6, Part09/11
  4. Sender: sources-moderator@pa.dec.com
  5. Approved: vixie@pa.dec.com
  6.  
  7. Submitted-By: hammer@cs.purdue.edu (Adam Hammer)
  8. Posting-Number: Volume 25, Issue 85
  9. Archive-Name: rcs-5.6/part09
  10.  
  11. #! /bin/sh
  12. # This is a shell archive.  Remove anything before this line, then unpack
  13. # it by saving it into a file and typing "sh file".  To overwrite existing
  14. # files, type "sh file -c".  You can also feed this as standard input via
  15. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  16. # will see the following message at the end:
  17. #        "End of archive 9 (of 11)."
  18. # Contents:  rcs.ms
  19. # Wrapped by vixie@cognition.pa.dec.com on Fri Dec 20 16:23:42 1991
  20. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  21. if test -f 'rcs.ms' -a "${1}" != "-c" ; then 
  22.   echo shar: Will not clobber existing file \"'rcs.ms'\"
  23. else
  24. echo shar: Extracting \"'rcs.ms'\" \(56906 characters\)
  25. sed "s/^X//" >'rcs.ms' <<'END_OF_FILE'
  26. X.\" Format this file with:
  27. X.\" pic file | tbl | troff -ms
  28. X.\"
  29. X.\" \*s stands for $, and avoids problems when this file is checked in.
  30. X.ds s $
  31. X.\" PS and PE center pic diagrams. (The corresponding ms-macros may not.)
  32. X.de PS
  33. X.nr pE (\\n(.lu-\\$2u)/2u
  34. X.in +\\n(pEu
  35. X.ne \\$1u
  36. X..
  37. X.de PE
  38. X.in -\\n(pEu
  39. X..
  40. X.de D(
  41. X.DS
  42. X.nr VS 12p
  43. X.vs 12p
  44. X.I
  45. X..
  46. X.de D)
  47. X.DE
  48. X.nr VS 18p
  49. X.vs 18p
  50. X.R
  51. X..
  52. X.de Id
  53. X.ND \\$4
  54. X..
  55. X.Id $Id: rcs.ms,v 5.2 1991/01/03 10:57:28 eggert Exp $
  56. X.RP
  57. X.TL
  58. RCS\*-A System for Version Control
  59. X.sp
  60. X.AU
  61. Walter F. Tichy
  62. X.AI
  63. Department of Computer Sciences
  64. Purdue University
  65. West Lafayette, Indiana 47907
  66. X.sp
  67. X.AB
  68. An important problem in program development and maintenance is version control,
  69. i.e., the task of keeping a software system consisting of many versions and
  70. configurations well organized.
  71. The Revision Control System (RCS)
  72. is a software tool that assists with that task.
  73. RCS manages revisions of text documents, in particular source programs,
  74. documentation, and test data.
  75. It automates the storing, retrieval, logging and identification of revisions,
  76. and it provides selection mechanisms for composing configurations.
  77. This paper introduces basic version control concepts and
  78. discusses the practice of version control
  79. using RCS.
  80. XFor conserving space, RCS stores deltas, i.e., differences between
  81. successive revisions.  Several delta storage methods are discussed.
  82. Usage statistics show that RCS's delta storage method is
  83. space and time efficient.
  84. The paper concludes with a detailed survey of version control tools.
  85. X.sp
  86. X\fBKeywords\fR: configuration management, history management,
  87. version control, revisions, deltas.
  88. X.AE
  89. X.FS
  90. An earlier version of this paper was published in
  91. X.I "Software\*-Practice & Experience"
  92. X.B 15 ,
  93. X7 (July 1985), 637-654.
  94. X.FE
  95. X.nr VS 18p
  96. X.LP
  97. X.NH
  98. Introduction
  99. X.PP
  100. Version control is the task of keeping software
  101. systems consisting of many versions and configurations well organized.
  102. The Revision Control System (RCS) is a set of UNIX
  103. commands that assist with that task.
  104. X.PP
  105. RCS' primary function is to manage \fIrevision groups\fR.
  106. A revision group is a set of text documents, called \fIrevisions\fR,
  107. that evolved from each other.  A new revision is
  108. created by manually editing an existing one.
  109. RCS organizes the revisions into an ancestral tree.  The initial revision
  110. is the root of the tree, and the tree edges indicate
  111. from which revision a given one evolved.
  112. Besides managing individual revision groups, RCS provides
  113. flexible selection functions for composing configurations.
  114. RCS may be combined with MAKE\u1\d,
  115. resulting in a powerful package for version control.
  116. X.PP
  117. RCS also offers facilities for
  118. merging updates with customer modifications,
  119. for distributed software development, and
  120. for automatic identification.
  121. Identification is the `stamping'
  122. of revisions and configurations with unique markers.
  123. These markers are akin to serial numbers,
  124. telling software maintainers unambiguously which configuration
  125. is before them.
  126. X.PP
  127. RCS is designed for both production and experimental
  128. environments.
  129. In production environments,
  130. access controls detect update conflicts and prevent overlapping changes.
  131. In experimental environments, where strong controls are
  132. counterproductive, it is possible to loosen the controls.
  133. X.PP
  134. Although RCS was originally intended for programs, it is useful for any
  135. text that is revised frequently and whose previous revisions must be
  136. preserved.  RCS has been applied successfully to store the source
  137. text for drawings, VLSI layouts, documentation, specifications,
  138. test data, form letters and articles.
  139. X.PP
  140. This paper discusses the practice of
  141. version control using RCS.
  142. It also introduces basic version control concepts,
  143. useful for clarifying current practice and designing similar systems.
  144. Revision groups of individual components are treated in the next three sections,
  145. and the extensions to configurations follow.
  146. Because of its size, a survey of version control tools
  147. appears at the end of the paper.
  148. X.NH
  149. Getting started with RCS
  150. X.PP
  151. Suppose a text file \fIf.c\fR is to be placed under control of RCS.
  152. Invoking the check-in command
  153. X.D(
  154. ci  f.c
  155. X.D)
  156. creates a new revision group with the contents of
  157. X\fIf.c\fR as the initial
  158. revision (numbered 1.1)
  159. and stores the group into the file \fIf.c,v\fR.
  160. Unless told otherwise, the command deletes \fIf.c\fR.
  161. It also asks for a description of the group.
  162. The description should state the common purpose of all revisions in the group,
  163. and becomes part of the group's documentation.
  164. All later check-in commands will ask for a log entry,
  165. which should summarize the changes made.
  166. X(The first revision is assigned a default log message,
  167. which just records the fact that it is the initial revision.)
  168. X.PP
  169. XFiles ending in \fI,v\fR
  170. are called \fIRCS files\fR (\fIv\fR stands for \fIv\fRersions);
  171. the others are called working files.
  172. To get back the working file \fIf.c\fR in the previous example,
  173. execute the check-out command:
  174. X.D(
  175. co  f.c
  176. X.D)
  177. X.R
  178. This command extracts the latest revision from
  179. the revision group \fIf.c,v\fR and writes
  180. it into \fIf.c\fR.
  181. The file \fIf.c\fR can now be edited and, when finished,
  182. checked back in with \fIci\fR:
  183. X.D(
  184. ci  f.c
  185. X.D)
  186. X\fICi\fR assigns number 1.2 to
  187. the new revision.
  188. If \fIci\fR complains with the message
  189. X.D(
  190. ci error: no lock set by <login>
  191. X.D)
  192. then the system administrator has decided to configure RCS for a
  193. production environment by enabling the `strict locking feature'.
  194. If this feature is enabled, all RCS files are initialized
  195. such that check-in operations require a lock on the previous revision
  196. X(the one from which the current one evolved).
  197. Locking prevents overlapping modifications if several people work on the same file.
  198. If locking is required, the revision should
  199. have been locked during the check-out by using
  200. the option \fI\-l\fR:
  201. X.D(
  202. co  \-l  f.c
  203. X.D)
  204. Of course it is too late now for the check-out with locking, because
  205. X\fIf.c\fR has already been changed; checking out the file again
  206. would overwrite the modifications.
  207. X(To prevent accidental overwrites, \fIco\fR senses the presence
  208. of a working file and asks whether the user really intended to overwrite it.
  209. The overwriting check-out is sometimes useful for
  210. backing up to the previous revision.)
  211. To be able to proceed with the check-in in the present case, first execute
  212. X.D(
  213. rcs  \-l  f.c
  214. X.D)
  215. This command retroactively locks the latest revision, unless someone
  216. else locked it in the meantime.  In this case, the two programmers
  217. involved have to negotiate whose
  218. modifications should take precedence.
  219. X.PP
  220. If an RCS file is private, i.e., if only the owner of the file is expected
  221. to deposit revisions into it, the strict locking feature is unnecessary and
  222. may be disabled.
  223. If strict locking is disabled,
  224. the owner of the RCS file need not have a lock for check-in.
  225. XFor safety reasons, all others
  226. still do.  Turning strict locking off and on is done with the commands:
  227. X.D(
  228. rcs  \-U  f.c       \fRand\fP         rcs  \-L  f.c
  229. X.D)
  230. These commands enable or disable the strict locking feature for each RCS file
  231. individually.
  232. The system administrator only decides whether strict locking is
  233. enabled initially.
  234. X.PP
  235. To reduce the clutter in a working directory, all RCS files can be moved
  236. to a subdirectory with the name \fIRCS\fR.
  237. RCS commands look first into that directory for RCS files.
  238. All the commands presented above work
  239. with the \fIRCS\fR subdirectory without change.\(dg
  240. X.FS \(dg
  241. Pairs of RCS and working files can actually be specified in 3 ways:
  242. a) both are given, b) only the working file is given, c) only the
  243. RCS file is given.
  244. If a pair is given, both files may have arbitrary path prefixes;
  245. RCS commands pair them up intelligently.
  246. X.FE
  247. X.PP
  248. It may be undesirable that \fIci\fR deletes the working file.
  249. XFor instance, sometimes one would like to save the current revision,
  250. but continue editing.
  251. Invoking
  252. X.D(
  253. ci  \-l  f.c
  254. X.D)
  255. checks in \fIf.c\fR as usual, but performs an additional
  256. check-out with locking afterwards.  Thus, the working file does
  257. not disappear after the check-in.
  258. Similarly, the option
  259. X\fI\-u\fR does a check-in followed by a check-out without
  260. locking.  This option is useful if the file is needed for compilation after the check-in.
  261. Both options update the identification markers in the working file
  262. X(see below).
  263. X.PP
  264. Besides the operations \fIci\fR and \fIco\fR, RCS provides the following
  265. commands:
  266. X.sp 0
  267. X.nr VS 12p
  268. X.vs 12p
  269. X.TS
  270. tab(%);
  271. li l.
  272. ident%extract identification markers
  273. rcs%change RCS file attributes
  274. rcsclean%remove unchanged working files (optional)
  275. rcsdiff%compare revisions
  276. rcsfreeze%record a configuration (optional)
  277. rcsmerge%merge revisions
  278. rlog%read log messages and other information in RCS files
  279. X.TE
  280. A synopsis of these commands appears in the Appendix.
  281. X.NH 2
  282. Automatic Identification
  283. X.PP
  284. RCS can stamp source and object code with special identification strings,
  285. similar to product and serial numbers.
  286. To obtain such identification, place the marker
  287. X.D(
  288. X\*sId\*s
  289. X.D)
  290. into the text of a revision, for instance inside a comment.
  291. The check-out operation will replace this marker with a string of the form
  292. X.D(
  293. X\*sId:  filename  revisionnumber  date  time  author  state  locker \*s
  294. X.D)
  295. This string need never be touched, because \fIco\fR keeps it
  296. up to date automatically.
  297. To propagate the marker into object code, simply put
  298. it into a literal character string.  In C, this is done as follows:
  299. X.D(
  300. static char rcsid[] = \&"\*sId\*s\&";
  301. X.D)
  302. The command \fIident\fR extracts such markers from any file, in particular from
  303. object code.
  304. X\fIIdent\fR helps to find out
  305. which revisions of which modules were used in a given program.
  306. It returns a complete and unambiguous component list,
  307. from which a copy of the program can be reconstructed.
  308. This facility is invaluable for program maintenance.
  309. X.PP
  310. There are several additional identification markers, one for each component
  311. of \*sId\*s.
  312. The marker
  313. X.D(
  314. X\*sLog\*s
  315. X.D)
  316. has a similar function.  It accumulates
  317. the log messages that are requested during check-in.
  318. Thus, one can maintain the complete history of a revision directly inside it,
  319. by enclosing it in a comment.
  320. XFigure 1 is a partial reproduction of a log contained in revision 4.1 of
  321. the file \fIci.c\fR.  The log appears at the beginning of the file,
  322. and makes it easy to determine what the recent modifications were.
  323. X.sp
  324. X.nr VS 12p
  325. X.vs 12p
  326. X.ne 18
  327. X.nf
  328. X.in +0.5i
  329. X/* \*sLog: ci.c,v \*s
  330. X * Revision 4.1  1983/05/10  17:03:06  wft
  331. X * Added option \-d and \-w, and updated assignment of date, etc. to new delta.
  332. X * Added handling of default branches.
  333. X *
  334. X * Revision 3.9  1983/02/15  15:25:44  wft
  335. X * Added call to fastcopy() to copy remainder of RCS file.
  336. X *
  337. X * Revision 3.8  1983/01/14  15:34:05  wft
  338. X * Added ignoring of interrupts while new RCS file is renamed;
  339. X * avoids deletion of RCS files by interrupts.
  340. X *
  341. X * Revision 3.7  1982/12/10  16:09:20  wft
  342. X * Corrected checking of return code from diff.
  343. X * An RCS file now inherits its mode during the first ci from the working file,
  344. X * except that write permission is removed.
  345. X */
  346. X.in 0
  347. X.ce 1
  348. XFigure 1.  Log entries produced by the marker \*sLog\*s.
  349. X.fi
  350. X.nr VS 18p
  351. X.vs 18p
  352. X.sp 0
  353. X.LP
  354. Since revisions are stored in the form of differences,
  355. each log message is
  356. physically stored once,
  357. independent of the number of revisions present.
  358. Thus, the \*sLog\*s marker incurs negligible space overhead.
  359. X.NH
  360. The RCS Revision Tree
  361. X.PP
  362. RCS arranges revisions in an ancestral tree.
  363. The \fIci\fR command builds this tree; the auxiliary command \fIrcs\fR
  364. prunes it.
  365. The tree has a root revision, normally numbered 1.1, and successive revisions
  366. are numbered 1.2, 1.3, etc.  The first field of a revision number
  367. is called the \fIrelease number\fR and the second one
  368. the \fIlevel number\fR.  Unless given explicitly,
  369. the \fIci\fR command assigns a new revision number
  370. by incrementing the level number of the previous revision.
  371. The release number must be incremented explicitly, using the
  372. X\fI\-r\fR option of \fIci\fR.
  373. Assuming there are revisions 1.1, 1.2, and 1.3 in the RCS file f.c,v, the command
  374. X.D(
  375. ci  \-r2.1  f.c       \fRor\fP       ci  \-r2  f.c
  376. X.D)
  377. assigns the number 2.1 to the new revision.
  378. Later check-ins without the \fI\-r\fR option will assign the numbers 2.2, 2.3,
  379. and so on.
  380. The release number should be incremented only at major transition points
  381. in the development, for instance when a new release of a software product has
  382. been completed.
  383. X.NH 2
  384. When are branches needed?
  385. X.PP
  386. A young revision tree is slender:
  387. It consists of only one branch, called the trunk.
  388. As the tree ages, side branches may form.
  389. Branches are needed in the following 4 situations.
  390. X.IP "\fITemporary fixes\fR"
  391. X.sp 0
  392. Suppose a tree has 5 revisions grouped in 2 releases,
  393. as illustrated in Figure 2.
  394. Revision 1.3, the last one of release 1, is in operation at customer sites,
  395. while release 2 is in active development.
  396. X.ne 4
  397. X.PS 4i
  398. X.ps -2
  399. box "1.1"
  400. arrow
  401. box "1.2"
  402. arrow
  403. box "1.3"
  404. arrow
  405. box "2.1"
  406. arrow
  407. box "2.2"
  408. arrow dashed
  409. X.ps +2
  410. X.PE
  411. X.ce 1
  412. XFigure 2.  A slender revision tree.
  413. X.sp 0
  414. Now imagine a customer requesting a fix of
  415. a problem in revision 1.3, although actual development has moved on
  416. to release 2.  RCS does not permit an extra
  417. revision to be spliced in between 1.3 and 2.1, since that would not reflect
  418. the actual development history.  Instead, create a branch
  419. at revision 1.3, and check in the fix on that branch.
  420. The first branch starting at 1.3 has number 1.3.1, and
  421. the revisions on that branch are numbered 1.3.1.1, 1.3.1.2, etc.
  422. The double numbering is needed to allow for another
  423. branch at 1.3, say 1.3.2.
  424. Revisions on the second branch would be numbered
  425. X1.3.2.1, 1.3.2.2, and so on.
  426. The following steps create
  427. branch 1.3.1 and add revision 1.3.1.1:
  428. X.sp 0
  429. X.I
  430. X.nr VS 12p
  431. X.vs 12p
  432. X.TS
  433. tab(%);
  434. l l l.
  435. X     %co  \-r1.3  f.c% \*- check out revision 1.3
  436. X     %edit  f.c% \*- change it
  437. X     %ci  \-r1.3.1  f.c% \*- check it in on branch 1.3.1
  438. X.TE
  439. X.nr VS 18p
  440. X.vs 18p
  441. X.R
  442. This sequence of commands transforms the tree of Figure 2 into
  443. the one in Figure 3.
  444. Note that it may be necessary to incorporate the differences
  445. between 1.3 and 1.3.1.1
  446. into a revision at level 2.  The operation \fIrcsmerge\fR automates this
  447. process (see the Appendix).
  448. X.ne 7
  449. X.PS  4i
  450. X.ps -2
  451. X     box "1.1"
  452. X     arrow
  453. X     box "1.2"
  454. X     arrow
  455. R13: box "1.3"
  456. X     arrow
  457. R21: box "2.1"
  458. X     arrow
  459. R22: box "2.2"
  460. X     arrow dashed
  461. X     line invis down from R21.s
  462. RB1: box "1.3.1.1"
  463. X     arrow dashed right from RB1.e
  464. X     arrow from R13.s to RB1.w
  465. X.ps +2
  466. X.PE
  467. X.ce 1
  468. XFigure 3.  A revision tree with one side branch
  469. X.sp
  470. X.IP "\fIDistributed development and customer modifications\fR"
  471. X.sp 0
  472. Assume a situation as in Figure 2, where revision 1.3 is in operation
  473. at several customer sites,
  474. while release 2 is in development.
  475. Customer sites should use RCS to store the distributed software.
  476. However, customer modifications should not be placed on the same branch
  477. as the distributed source; instead, they should be placed on a side branch.
  478. When the next software distribution arrives,
  479. it should be appended to the trunk of
  480. the customer's RCS file, and the customer
  481. can then merge the local modifications back into the new release.
  482. In the above example, a
  483. customer's RCS file would contain the following tree, assuming
  484. that the customer has received revision 1.3, added his local modifications
  485. as revision 1.3.1.1, then received revision 2.4, and merged
  486. X2.4 and 1.3.1.1, resulting in 2.4.1.1.
  487. X.ne 7
  488. X.PS  4i
  489. X.ps -2
  490. R13: box "1.3"
  491. X     line invis
  492. R21: box invis
  493. X     line invis
  494. R22: box invis
  495. X     line invis
  496. R24: box "2.4"
  497. X     line invis
  498. R25: box invis
  499. X     line invis
  500. X     arrow from R13.e to R24.w
  501. X     line invis down from R21.s
  502. RB1: box "1.3.1.1"
  503. X     arrow from R13.s to RB1.w
  504. X     right
  505. X     line invis down from R25.s
  506. RB2: box "2.4.1.1"
  507. X     arrow from R24.s to RB2.w
  508. X.ps +2
  509. X.PE
  510. X.ce 1
  511. XFigure 4.  A customer's revision tree with local modifications.
  512. X.sp 1
  513. This approach is actually practiced in the CSNET project,
  514. where several universities and a company cooperate
  515. in developing a national computer network.
  516. X.IP "\fIParallel development\fR"
  517. X.sp 0
  518. Sometimes it is desirable to explore an alternate design or
  519. a different implementation technique in parallel with the
  520. main line development.  Such development
  521. should be carried out on a side branch.
  522. The experimental changes may later be moved into the main line, or abandoned.
  523. X.IP "\fIConflicting updates\fR"
  524. X.sp 0
  525. A common occurrence is that one programmer
  526. has checked out a revision, but cannot complete the assignment
  527. for some reason.  In the meantime, another person
  528. must perform another modification
  529. immediately.  In that case, the second person should check-out the same revision,
  530. modify it, and check it in on a side branch, for later merging.
  531. X.PP
  532. XEvery node in a revision tree consists of the following attributes:
  533. a revision number, a check-in date and time, the author's identification,
  534. a log entry, a state and the actual text.  All these attributes
  535. are determined at the time the revision is checked in.
  536. The state attribute indicates the status of a revision.
  537. It is set automatically to `experimental' during check-in.
  538. A revision can later be promoted to a higher status, for example
  539. X`stable' or `released'.  The set of states is user-defined.
  540. X.NH 2
  541. Revisions are represented as deltas
  542. X.PP
  543. XFor conserving space, RCS stores revisions in the form
  544. of deltas, i.e., as differences between revisions.
  545. The user interface completely hides this fact.
  546. X.PP
  547. A delta is a sequence of edit commands that transforms one string
  548. into another.  The deltas employed by RCS are line-based, which means
  549. that the only edit commands allowed are insertion and deletion of lines.
  550. If a single character in a line is changed, the
  551. edit scripts consider the entire line changed.
  552. The program \fIdiff\fR\u2\d
  553. produces a small, line-based delta between pairs of text files.
  554. A character-based edit script would take much longer to compute,
  555. and would not be significantly shorter.
  556. X.PP
  557. Using deltas is a classical space-time tradeoff: deltas reduce the
  558. space consumed, but increase access time.
  559. However, a version control tool should impose as little delay
  560. as possible on programmers.
  561. XExcessive delays discourage the use of version controls,
  562. or induce programmers to take shortcuts that compromise system integrity.
  563. To gain reasonably fast access time for both editing and compiling,
  564. RCS arranges deltas in the following way.
  565. The most recent revision on the trunk is stored intact.
  566. All other revisions on the trunk are stored as reverse deltas.
  567. A reverse delta describes how to go backward in the development history:
  568. it produces the desired revision if applied to the successor of that revision.
  569. This implementation has the advantage
  570. that extraction of the latest revision is a simple and fast copy
  571. operation.
  572. Adding a new revision to the trunk is also fast: \fIci\fR simply
  573. adds the new revision intact, replaces the previous
  574. revision with a reverse delta, and keeps the rest of the old deltas.
  575. Thus, \fIci\fR requires the computation
  576. of only one new delta.
  577. X.PP
  578. Branches need special treatment.  The naive solution would be to
  579. store complete copies for the tips of all branches.
  580. Clearly, this approach would cost too much space.  Instead,
  581. RCS uses \fIforward\fR deltas for branches.  Regenerating a revision
  582. on a side branch proceeds as follows.  First, extract the latest revision
  583. on the trunk; secondly, apply reverse deltas until the fork revision for
  584. the branch is obtained; thirdly, apply forward deltas until the desired
  585. branch revision is reached.  Figure 5 illustrates a tree with
  586. one side branch.  Triangles pointing to the left and right represent
  587. reverse and forward deltas, respectively.
  588. X.ne 8
  589. X.PS  4i
  590. X.ps -2
  591. define BD X [line invis $1 right .5;
  592. line up .3 then left .5 down .3 then right .5 down .3 then up .3] X
  593. X
  594. define FD X [line invis $1 right .5;
  595. line left .5 down .3 then up .6 then right .5 down .3;] X
  596. X
  597. right
  598. D11:    BD(" 1.1")
  599. X    arrow right from D11.e
  600. D12:    BD(" 1.2")
  601. X    arrow  right from D12.e
  602. D13:    BD(" 1.3")
  603. X    arrow  right from D13.e
  604. D21:    BD(" 2.1")
  605. X    arrow  right from D21.e
  606. D22:    box "2.2"
  607. X    line invis down from D21.s
  608. XF1:     FD("1.3.1.1 ")
  609. X    arrow from D13.se to F1.w
  610. X    arrow from F1.e right
  611. X    right
  612. XF2:     FD("1.3.1.2 ")
  613. X.ps +2
  614. X.PE
  615. X.ce 1
  616. XFigure 5.  A revision tree with reverse and forward deltas.
  617. X.sp 0
  618. X.PP
  619. Although implementing fast check-out for the latest trunk revision,
  620. this arrangement has the disadvantage that generation of other revisions
  621. takes time proportional to the number of deltas applied.  For example,
  622. regenerating the branch tip in Figure 5 requires application of five
  623. deltas (including the initial one).  Since usage statistics show that
  624. the latest trunk revision is the one that is retrieved in 95 per cent
  625. of all cases (see the section on usage statistics), biasing check-out time
  626. in favor of that revision results in significant savings.
  627. However, careful implementation of the delta application process is
  628. necessary to provide low retrieval overhead for other revisions, in
  629. particular for branch tips.
  630. X.PP
  631. There are several techniques for delta application.
  632. The naive one is to pass each delta to a general-purpose text editor.
  633. A prototype of RCS invoked the UNIX editor \fIed\fR both
  634. for applying deltas and for expanding the identification markers.
  635. Although easy to implement, performance was poor, owing to the
  636. high start-up costs and excess generality of \fIed\fR.  An intermediate
  637. version of RCS used a special-purpose, stream-oriented editor.
  638. This technique reduced the cost of applying a delta to the cost of
  639. checking out the latest trunk revision.  The reason for this behavior
  640. is that each delta application involves a complete pass over
  641. the preceding revision.
  642. X.PP
  643. However, there is a much better algorithm.  Note that the deltas are
  644. line oriented and that most of the work of a stream editor involves
  645. copying unchanged lines from one revision to the next.  A faster
  646. algorithm avoids unnecessary copying of character strings by using
  647. a \fIpiece table\fR.
  648. A piece table is a one-dimensional array, specifying how a given
  649. revision is `pieced together' from lines in the RCS file.
  650. Suppose piece table \fIPT\dr\u\fR represents revision \fIr\fR.
  651. Then \fIPT\dr\u[i]\fR contains the starting position of line \fIi\fR
  652. of revision \fIr\fR.
  653. Application of the next delta transforms piece table \fIPT\dr\u\fR
  654. into \fIPT\dr+1\u\fR.  For instance, a delete command removes a
  655. series of entries from the piece table.  An insertion command inserts
  656. new entries, moving the entries following the insertion point further down the
  657. array.  The inserted entries point to the text lines in the delta.
  658. Thus, no I/O is involved except for reading the delta itself.  When all
  659. deltas have been applied to the piece table, a sequential pass
  660. through the table looks up each line in the RCS file and copies it to
  661. the output file, updating identification markers at the same time.
  662. Of course, the RCS file must permit random access, since the copied
  663. lines are scattered throughout that file.  Figure 6 illustrates an
  664. RCS file with two revisions and the corresponding piece tables.
  665. X.ne 13
  666. X.sp 6
  667. X.ce 1
  668. X\fIFigure 6 is not available.\fP
  669. X.sp 5
  670. X.ce 1
  671. XFigure 6.  An RCS file and its piece tables
  672. X.sp 0
  673. X.PP
  674. The piece table approach has the property that the time for applying a single
  675. delta is roughly determined by the size of the delta, and not by the
  676. size of the revision.  For example, if a delta is
  677. X10 per cent of the size of a revision, then applying it takes only
  678. X10 per cent of the time to generate the latest trunk revision.  (The stream
  679. editor would take 100 per cent.)
  680. X.PP
  681. There is an important alternative for representing deltas that affects
  682. performance.  SCCS\u3\d,
  683. a precursor of RCS, uses \fIinterleaved\fR deltas.
  684. A file containing interleaved deltas is partitioned into blocks of lines.
  685. XEach block has a header that specifies to which revision(s) the block
  686. belongs.  The blocks are sorted out in such a way that a single
  687. pass over the file can pick up all the lines belonging to a given
  688. revision.  Thus, the regeneration time for all revisions is the same:
  689. all headers must be inspected, and the associated blocks either copied
  690. or skipped.  As the number of revisions increases, the cost of retrieving
  691. any revision is much higher than the cost of checking out the
  692. latest trunk revision with reverse deltas.  A detailed comparison
  693. of SCCS's interleaved deltas and RCS's reverse deltas can be found
  694. in Reference 4.
  695. This reference considers the version of RCS with the
  696. stream editor only.  The piece table method improves performance
  697. further, so that RCS is always faster than SCCS, except if 10
  698. or more deltas are applied.
  699. X.PP
  700. Additional speed-up for both delta methods can be obtained by caching
  701. the most recently generated revision, as has been implemented in DSEE.\u5\d
  702. With caching, access time to frequently used revisions can approach normal file
  703. access time, at the cost of some additional space.
  704. X.NH
  705. Locking: A Controversial Issue
  706. X.PP
  707. The locking mechanism for RCS was difficult to design.
  708. The problem and its solution are first presented in their `pure' form,
  709. followed by a discussion of the complications
  710. caused by `real-world' considerations.
  711. X.PP
  712. RCS must prevent two or more persons from depositing competing changes of the
  713. same revision.
  714. Suppose two programmers check out revision 2.4 and
  715. modify it.  Programmer A checks in a revision before programmer B\&.
  716. Unfortunately, programmer B has not seen A's
  717. changes, so the effect is that A's changes are covered up by B's deposit.
  718. A's changes are not lost since all revisions
  719. are saved, but they are confined to a single revision.\(dd
  720. X.FS \(dd
  721. Note that this problem is entirely different from the atomicity problem.
  722. Atomicity means that
  723. concurrent update operations on the same RCS file cannot be permitted,
  724. because that may result in inconsistent data.
  725. Atomic updates are essential (and implemented in RCS),
  726. but do not solve the conflict discussed here.
  727. X.FE
  728. X.PP
  729. This conflict is prevented in RCS by locking.
  730. Whenever someone intends to edit a revision (as opposed
  731. to reading or compiling it), the revision should be checked out
  732. and locked,
  733. using the \fI\-l\fR option on \fIco\fR.  On subsequent check-in,
  734. X\fIci\fR tests the lock and then removes it.
  735. At most one programmer at a time may
  736. lock a particular revision, and only this programmer may check in
  737. the succeeding revision.
  738. Thus, while a revision is locked, it is the exclusive responsibility
  739. of the locker.
  740. X.PP
  741. An important maxim for software tools like RCS is that they must
  742. not stand in the way of making progress with a project.
  743. This consideration leads to several weakenings of the locking mechanism.
  744. XFirst of all, even if a revision is locked, it can
  745. still be checked out.  This is necessary if other people
  746. wish to compile or inspect the locked revision
  747. while the next one is in preparation.  The only operations they
  748. cannot do are to lock the revision or to check in the succeeding one.  Secondly,
  749. check-in operations on other branches in the RCS file are still possible; the
  750. locking of one revision does not affect any other revision.
  751. Thirdly, revisions are occasionally locked for a long period of time
  752. because a programmer is absent or otherwise unable to complete
  753. the assignment.  If another programmer has to make a pressing change,
  754. there are the following three alternatives for making progress:
  755. a) find out who is holding the lock and ask that person to release it;
  756. b) check out the locked revision, modify it, check it
  757. in on a branch, and merge the changes later;
  758. c) break the lock.  Breaking a lock leaves a highly visible
  759. trace, namely an electronic mail message that is sent automatically to the
  760. holder of the lock, recording the breaker and a commentary requested from him.
  761. Thus, breaking locks is tolerated under certain circumstances,
  762. but will not go unnoticed.
  763. XExperience has shown that the automatic mail message attaches a high enough
  764. stigma to lock breaking,
  765. such that programmers break locks only in real emergencies,
  766. or when a co-worker resigns and leaves locked revisions behind.
  767. X.PP
  768. If an RCS file is private, i.e., when a programmer owns an RCS file
  769. and does not expect anyone else to perform check-in operations,
  770. locking is an unnecessary nuisance.
  771. In this case,
  772. the `strict locking feature' discussed earlier may be disabled,
  773. provided that file protection
  774. is set such that only the owner may write the RCS file.
  775. This has the effect that only the owner can check-in revisions,
  776. and that no lock is needed for doing so.
  777. X.PP
  778. As added protection,
  779. each RCS file contains an access list that specifies the users
  780. who may execute update operations.  If an access list is empty,
  781. only normal UNIX file protection applies.  Thus, the access list is
  782. useful for restricting the set of people who would otherwise have update
  783. permission.  Just as with locking, the access list
  784. has no effect on read-only operations such as \fIco\fR.  This approach
  785. is consistent with the UNIX philosophy of openness, which contributes
  786. to a productive software development environment.
  787. X.NH
  788. Configuration Management
  789. X.PP
  790. The preceding sections described how RCS deals with revisions of individual
  791. components; this section discusses how to handle configurations.
  792. A configuration is a set of revisions, where each revision comes
  793. from a different revision group, and the revisions are selected
  794. according to a certain criterion.
  795. XFor example,
  796. in order to build a functioning compiler, the `right'
  797. revisions from the scanner, the parser, the optimizer
  798. and the code generator must be combined.
  799. RCS, in conjunction with MAKE,
  800. provides a number of facilities to effect a smooth selection.
  801. X.NH 2
  802. RCS Selection Functions
  803. X.PP
  804. X.IP "\fIDefault selection\fR"
  805. X.sp 0
  806. During development, the usual selection criterion is to choose
  807. the latest revision of all components.  The \fIco\fR command
  808. makes this selection by default.  For example, the command
  809. X.D(
  810. co  *,v
  811. X.D)
  812. retrieves the latest revision on the default branch of each RCS file
  813. in the current directory.
  814. The default branch is usually the trunk, but may be
  815. set to be a side branch.
  816. Side branches as defaults are needed in distributed software development,
  817. as discussed in the section on the RCS revision tree.
  818. X.sp
  819. X.IP "\fIRelease based selection\fR"
  820. X.sp 0
  821. Specifying a release or branch number selects the latest revision in
  822. that release or branch.
  823. XFor instance,
  824. X.D(
  825. co  \-r2  *,v
  826. X.D)
  827. retrieves the latest revision with release number 2 from each RCS file.
  828. This selection is convenient if a release has been completed and
  829. development has moved on to the next release.
  830. X.sp
  831. X.IP "\fIState and author based selection\fR"
  832. X.sp 0
  833. If the highest level number within a given release number
  834. is not the desired one,
  835. the state attribute can help.  For example,
  836. X.D(
  837. co  \-r2  \-sReleased  *,v
  838. X.D)
  839. retrieves the latest revision with release number 2 whose state attribute
  840. is `Released'.
  841. Of course, the state attribute has to be set appropriately, using the
  842. X\fIci\fR or \fIrcs\fR commands.
  843. Another alternative is to select a revision by its author,
  844. using the \fI\-w\fR option.
  845. X.sp
  846. X.IP "\fIDate based selection\fR"
  847. X.sp 0
  848. Revisions may also be selected by date.
  849. Suppose a release of an entire system was
  850. completed and current on March 4, at 1:00 p.m. local time.  Then the command
  851. X.D(
  852. co  \-d'March 4, 1:00 pm LT'  *,v
  853. X.D)
  854. checks out all the components of that release, independent of the numbering.
  855. The \fI\-d\fR option specifies a `cutoff date', i.e.,
  856. the revision selected has a check-in date that
  857. is closest to, but not after the date given.
  858. X.IP "\fIName based selection\fR"
  859. X.sp 0
  860. The most powerful selection function is based on assigning symbolic
  861. names to revisions and branches.
  862. In large systems, a single release number or date is not sufficient
  863. to collect the appropriate revisions from all groups.
  864. XFor example, suppose one wishes to combine release 2
  865. of one subsystem and release 15 of another.
  866. Most likely, the creation dates of those releases differ also.
  867. Thus, a single revision number or date passed to the \fIco\fR command
  868. will not suffice to select the right revisions.
  869. Symbolic revision numbers solve this problem.
  870. XEach RCS file may contain a set of symbolic names that are mapped
  871. to numeric revision numbers.  For example, assume
  872. the symbol \fIV3\fR is bound to release number 2 in file \fIs,v\fR, and to
  873. revision number 15.9 in \fIt,v\fR.
  874. Then the single command
  875. X.D(
  876. co  \-rV3  s,v  t,v
  877. X.D)
  878. retrieves the latest revision of release 2 from \fIs,v\fR,
  879. and revision 15.9 from \fIt,v\fR.
  880. In a large system with many modules, checking out all
  881. revisions with one command greatly simplifies configuration management.
  882. X.PP
  883. Judicious use of symbolic revision numbers helps with organizing
  884. large configurations.
  885. A special command, \fIrcsfreeze\fR,
  886. assigns a symbolic revision number to a selected revision
  887. in every RCS file.
  888. X\fIRcsfreeze\fR effectively freezes a configuration.
  889. The assigned symbolic revision number selects all components
  890. of the configuration.
  891. If necessary, symbolic numbers
  892. may even be intermixed with numeric ones.  Thus, \fIV3.5\fR in the
  893. above example
  894. would select revision 2.5 in \fIs,v\fR and branch 15.9.5 in \fIt,v\fR.
  895. X.PP
  896. The options \fI\-r\fR, \fI\-s\fR, \fI\-w\fR and \fI\-d\fR
  897. may be combined.  If a branch is given, the latest revision
  898. on that branch satisfying all conditions is retrieved;
  899. otherwise, the default branch is used.
  900. X.NH 2
  901. Combining MAKE and RCS
  902. X.PP
  903. MAKE\u1\d
  904. is a program that processes configurations.
  905. It is driven by configuration specifications
  906. recorded in a special file, called a `Makefile'.
  907. MAKE avoids redundant processing steps
  908. by comparing creation dates of source and processed objects.
  909. XFor example, when instructed to compile all
  910. modules of a given system, it only recompiles
  911. those source modules that were changed
  912. since they were processed last.
  913. X.PP
  914. MAKE has been extended with an auto-checkout feature for RCS.*
  915. X.FS *
  916. This auto-checkout extension is available only in some versions of MAKE,
  917. e.g. GNU MAKE.
  918. X.FE
  919. When a certain file to be processed is not present,
  920. MAKE attempts a check-out operation.
  921. If successful, MAKE performs the required processing, and then deletes
  922. the checked out file to conserve space.
  923. The selection parameters discussed above can be passed to MAKE
  924. either as parameters, or directly embedded in the Makefile.
  925. MAKE has also been extended to search the subdirectory named \fIRCS\fR
  926. for needed files, rather than just the current working directory.
  927. However, if a working file is present, MAKE totally ignores the corresponding
  928. RCS file and uses the working file.
  929. X(In newer versions of MAKE distributed by AT&T and others,
  930. auto-checkout can be
  931. achieved with the rule DEFAULT, instead of a special extension of MAKE.
  932. However, a file checked out by the rule DEFAULT
  933. will not be deleted after processing. \fIRcsclean\fR can be
  934. used for that purpose.)
  935. X.PP
  936. With auto-checkout, RCS/MAKE can effect a selection rule
  937. especially tuned for multi-person software development and maintenance.
  938. In these situations,
  939. programmers should obtain configurations that consist of
  940. the revisions they have personally checked out plus the latest
  941. checked in revision of all other revision groups.
  942. This schema can be set up as follows.
  943. X.PP
  944. XEach programmer chooses a working directory
  945. and places into it a symbolic link, named \fIRCS\fR,
  946. to the directory containing the relevant RCS files.
  947. The symbolic link makes sure that \fIco\fR and \fIci\fR
  948. operations need only specify the working files, and that
  949. the Makefile need not be changed.
  950. The programmer then checks out the needed files and modifies them.
  951. If MAKE is invoked,
  952. it composes configurations by selecting those
  953. revisions that are checked out, and the rest from the
  954. subdirectory \fIRCS\fR.
  955. The latter selection may be controlled by a symbolic
  956. revision number or any of the other selection criteria.
  957. If there are several programmers editing in separate working directories,
  958. they are insulated from each other's changes until checking in their
  959. modifications.
  960. X.PP
  961. Similarly, a maintainer can recreate an older configuration
  962. by starting to work in an empty working directory.
  963. During the initial MAKE invocation, all revisions are selected from RCS files.
  964. As the maintainer checks out files and modifies them,
  965. a new configuration is gradually built up.
  966. XEvery time MAKE is invoked, it substitutes the modified revisions
  967. into the configuration being manipulated.
  968. X.PP
  969. A final application of RCS is to use it for storing Makefiles.
  970. Revision groups of Makefiles represent
  971. multiple versions of configurations.
  972. Whenever a configuration is baselined or distributed,
  973. the best approach is to unambiguously fix
  974. the configuration with a symbolic revision number by calling
  975. X\fIrcsfreeze\fR,
  976. to embed that symbol into the Makefile, and to
  977. check in the Makefile (using the same symbolic revision number).
  978. With this approach, old configurations
  979. can be regenerated easily and reliably.
  980. X.NH
  981. Usage Statistics
  982. X.PP
  983. The following usage statistics were collected on two DEC VAX-11/780
  984. computers of the Purdue Computer Science Department.  Both machines
  985. are mainly used for research purposes.  Thus, the data
  986. reflect an environment in which the majority of projects
  987. involve prototyping and advanced software development,
  988. but relatively little long-term maintenance.
  989. X.PP
  990. XFor the first experiment,
  991. the \fIci\fR and \fIco\fR operations were instrumented
  992. to log the number of backward and forward deltas applied.
  993. The data were collected during a 13 month period
  994. from Dec. 1982 to Dec. 1983.
  995. Table I summarizes the results.
  996. X.sp 0
  997. X.nr VS 12p
  998. X.vs 12p
  999. X.TS
  1000. center,box,tab(#);
  1001. c|c|c|c|c s|c s
  1002. c|c|c|c|c s|c s
  1003. l|n|n|n|n n|n n.
  1004. Operation#Total#Total deltas#Mean deltas#Operations#Branch
  1005. X     #operations #applied#applied#with >1 delta#operations
  1006. X_
  1007. co     # 7867# 9320#1.18#509#(6%)#203#(3%)
  1008. ci     # 3468# 2207#0.64# 85#(2%)# 75#(2%)
  1009. ci & co#11335#11527#1.02#594#(5%)#278#(2%)
  1010. X.TE
  1011. X.ce 1
  1012. Table I.  Statistics for \fIco\fR and \fIci\fR operations.
  1013. X.nr VS 18p
  1014. X.vs 18p
  1015. X.PP
  1016. The first two lines show statistics for check-out and check-in;
  1017. the third line shows the combination.
  1018. Recall that \fIci\fR performs an implicit check-out to obtain
  1019. a revision for computing the delta.
  1020. In all measures presented, the most recent revision (stored intact)
  1021. counts as one delta.  The number of deltas applied represents
  1022. the number of passes necessary, where the first `pass' is a copying step.
  1023. X.PP
  1024. Note that the check-out operation is executed more than
  1025. twice as frequently as the check-in operation.
  1026. The fourth column gives the mean number of deltas
  1027. applied in all three cases.
  1028. XFor \fIci\fR, the mean number of deltas applied is less
  1029. than one.
  1030. The reasons are that the initial check-in requires no delta at all, and that
  1031. the only time \fIci\fR requires more than one delta is for branches.
  1032. Column 5 shows the actual number of operations that applied more than one
  1033. delta.
  1034. The last column indicates that branches were not used often.
  1035. X.PP
  1036. The last three columns demonstrate that the most recent trunk revision
  1037. is by far the most frequently accessed.
  1038. XFor RCS, check-out of
  1039. this revision is a simple copy operation, which is the absolute minimum
  1040. given the copy-semantics of \fIco\fR.
  1041. Access to older revisions and branches
  1042. is more common in non-academic environments,
  1043. yet even if access to older deltas were an order
  1044. of magnitude more frequent,
  1045. the combined average number of deltas applied would still be below 1.2.
  1046. Since RCS is faster than SCCS until up to 10 delta applications,
  1047. reverse deltas are clearly the method of choice.
  1048. X.PP
  1049. The second experiment, conducted in March of 1984,
  1050. involved surveying the existing RCS files
  1051. on our two machines.  The goal was to determine the mean number of
  1052. revisions per RCS file, as well as the space consumed by them.
  1053. Table II shows the results.  (Tables I and II were produced at different
  1054. times and are unrelated.)
  1055. X.sp 0
  1056. X.nr VS 12p
  1057. X.vs 12p
  1058. X.TS
  1059. center,box,tab(#);
  1060. c | c | c | c | c | c | c
  1061. c | c | c | c | c | c | c
  1062. l | n | n | n | n | n | n.
  1063. X      #Total RCS#Total#Mean#Mean size of#Mean size of#Overhead
  1064. X      #files#revisions#revisions#RCS files#revisions
  1065. X_
  1066. All files #8033#11133#1.39#6156#5585#1.10
  1067. XFiles with#1477# 4578#3.10#8074#6041#1.34
  1068. X\(>= 2 deltas
  1069. X.TE
  1070. X.ce 1
  1071. Table II.  Statistics for RCS files.
  1072. X.nr VS 18p
  1073. X.vs 18p
  1074. X.PP
  1075. The mean number of revisions per RCS file is 1.39.
  1076. Columns 5 and 6 show the mean sizes (in bytes) of an RCS file
  1077. and of the latest revision of each RCS file, respectively.
  1078. The `overhead' column contains the ratio of the mean sizes.
  1079. Assuming that all revisions in an RCS file are approximately the same size,
  1080. this ratio gives a measure of the space consumed by the extra revisions.
  1081. X.PP
  1082. In our sample, over 80 per cent of the RCS files contained only a single revision.
  1083. The reason is that our
  1084. systems programmers routinely check in all source files
  1085. on the distribution tapes, even though they may never touch them again.
  1086. To get a better indication of how much space savings are possible
  1087. with deltas, all measures with those files
  1088. that contained 2 or more revisions were recomputed.  Only for those files
  1089. is RCS necessary.
  1090. As shown in the second line, the average number of revisions for those files is
  1091. X3.10, with an overhead of 1.34.  This means that the extra 2.10 deltas
  1092. require 34 per cent extra space, or
  1093. X16 per cent per extra revision.
  1094. Rochkind\u3\d
  1095. measured the space consumed by SCCS, and
  1096. reported an average of 5 revisions per group
  1097. and an overhead of 1.37 (or about 9 per cent per extra revision).
  1098. In a later paper, Glasser\u6\d
  1099. observed an average of 7 revisions per group in a single, large project,
  1100. but provided no overhead figure.
  1101. In his paper on DSEE\u5\d,
  1102. Leblang reported that delta storage combined with blank compression
  1103. results in an overhead of a mere 1\-2 per cent per revision.
  1104. Since leading blanks accounted for about 20 per cent of the surveyed Pascal
  1105. programs, a revision group with 5\-10 members was smaller
  1106. than a single cleartext copy.
  1107. X.PP
  1108. The above observations demonstrate clearly that the space needed
  1109. for extra revisions is small.  With delta storage, the luxury of
  1110. keeping multiple revisions online is certainly affordable.
  1111. In fact, introducing a system with delta storage may reduce
  1112. storage requirements, because programmers often save back-up copies
  1113. anyway.  Since back-up copies are stored much more efficiently with deltas,
  1114. introducing a system such as RCS may
  1115. actually free a considerable amount of space.
  1116. X.NH
  1117. Survey of Version Control Tools
  1118. X.PP
  1119. The need to keep back-up copies of software arose when
  1120. programs and data were no longer stored on paper media, but were entered
  1121. from terminals and stored on disk.
  1122. Back-up copies are desirable for reliability, and many modern editors
  1123. automatically save a back-up copy for every file touched.
  1124. This strategy
  1125. is valuable for short-term back-ups, but not suitable for long-term
  1126. version control, since an existing back-up copy is overwritten whenever the
  1127. corresponding file is edited.
  1128. X.PP
  1129. Tape archives are suitable for long-term, offline storage.
  1130. If all changed files are dumped on a back-up tape once per day, old revisions
  1131. remain accessible.  However, tape archives are unsatisfactory
  1132. for version control in several ways.  First, backing up the file
  1133. system every 24 hours does not capture intermediate revisions.
  1134. Secondly, the old revisions are not online,
  1135. and accessing them is tedious and time-consuming.
  1136. In particular, it is impractical to
  1137. compare several old revisions of a group,
  1138. because that may require mounting and searching several tapes.
  1139. Tape archives are important fail-safe tools in the
  1140. event of catastrophic disk failures or accidental deletions,
  1141. but they are ill-suited for version control.
  1142. Conversely, version control tools do not obviate the
  1143. need for tape archives.
  1144. X.PP
  1145. A natural technique for keeping several old revisions online is
  1146. to never delete a file.
  1147. XEditing a file
  1148. simply creates a new file with the same
  1149. name, but with a different sequence number.
  1150. This technique, available as an option in DEC's VMS operating system,
  1151. turns out to be inadequate for version control.
  1152. XFirst, it is prohibitively expensive in terms of storage costs,
  1153. especially since no data compression techniques are employed.
  1154. Secondly, indiscriminately storing every change produces too many
  1155. revisions, and programmers have difficulties distinguishing them.
  1156. The proliferation of revisions forces programmers to spend much time on
  1157. finding and deleting useless files.
  1158. Thirdly, most of the support functions like locking, logging,
  1159. revision selection,
  1160. and identification described in this paper are not available.
  1161. X.PP
  1162. An alternative approach is to separate editing from revision control.
  1163. The user may repeatedly edit a given revision,
  1164. until freezing it with an explicit command.
  1165. Once a revision is frozen, it is stored permanently and can no longer be modified.
  1166. X(In RCS, freezing a revisions is done with \fIci\fR.)
  1167. XEditing a frozen revision implicitly creates a new one, which
  1168. can again be changed repeatedly until it is frozen itself.
  1169. This approach saves exactly those revisions that the user
  1170. considers important, and keeps the number of revisions manageable.
  1171. IBM's CLEAR/CASTER\u7\d,
  1172. AT&T's SCCS\u3\d,
  1173. CMU's SDC\u8\d
  1174. and DEC's CMS\u9\d,
  1175. are examples of version control systems using this approach.
  1176. CLEAR/CASTER maintains a data base of programs, specifications,
  1177. documentation and messages, using deltas.
  1178. Its goal is to provide control over the development process from a
  1179. management viewpoint.
  1180. SCCS stores multiple revisions of source text in an ancestral tree,
  1181. records a log entry for each revision,
  1182. provides access control, and has facilities
  1183. for uniquely identifying each revision.
  1184. An efficient delta technique
  1185. reduces the space consumed by each revision group.
  1186. SDC is much simpler than SCCS because it stores not more than
  1187. two revisions.  However, it maintains a complete log for all old
  1188. revisions, some of which may be on back-up tape.
  1189. CMS, like SCCS, manages tree-structured revision groups,
  1190. but offers no identification mechanism.
  1191. X.PP
  1192. Tools for dealing with configurations are still in a state of flux.
  1193. SCCS, SDC and CMS can be combined with MAKE or MAKE-like programs.
  1194. Since flexible selection rules are missing from all these tools,
  1195. it is sometimes difficult
  1196. to specify precisely which revision of each group
  1197. should be passed to MAKE for building a desired configuration.
  1198. The Xerox Cedar system\u10\d
  1199. provides a `System Modeller' that can rebuild
  1200. a configuration from an arbitrary set of module revisions.
  1201. The revisions of a module are only distinguished by creation time,
  1202. and there is no tool for managing groups.
  1203. Since the selection rules are primitive,
  1204. the System Modeller appears to be somewhat tedious to use.
  1205. Apollo's DSEE\u5\d
  1206. is a sophisticated software engineering environment.
  1207. It manages revision groups in a way similar to SCCS and CMS.  Configurations
  1208. are built using `configuration threads'.
  1209. A configuration thread states which revision of each group
  1210. named in a configuration should be chosen.
  1211. A configuration thread may contain dynamic specifiers
  1212. X(e.g., `choose the revisions I am currently working on,
  1213. and the most recent revisions otherwise'), which are bound
  1214. automatically at build time.
  1215. It also provides a notification mechanism for alerting
  1216. maintainers about the need to rebuild a system after a change.
  1217. X.PP
  1218. RCS is based on a general model for describing
  1219. multi-version/multi-configuration systems\u11\d.
  1220. The model describes systems using AND/OR graphs, where AND nodes represent
  1221. configurations, and OR nodes represent version groups.
  1222. The model gives rise to a suit of selection rules for
  1223. composing configurations, almost all of which are implemented in RCS.
  1224. The revisions selected by RCS are passed to MAKE for configuration building.
  1225. Revision group management is modelled after SCCS.
  1226. RCS retains SCCS's best features,
  1227. but offers a significantly simpler user interface,
  1228. flexible selection rules, adequate integration with MAKE
  1229. and improved identification.
  1230. A detailed comparison of RCS and SCCS appears in Reference 4.
  1231. X.PP
  1232. An important component of all revision control systems
  1233. is a program for computing deltas.
  1234. SCCS and RCS use the program \fIdiff\fR\u2\d,
  1235. which first computes the longest common substring of two
  1236. revisions, and then produces the delta from that substring.
  1237. The delta is simply an edit script consisting of deletion and
  1238. insertion commands that generate one revision from the other.
  1239. X.PP
  1240. A delta based on a longest common substring is not necessarily minimal,
  1241. because it does not take advantage of crossing block moves.
  1242. Crossing block moves arise if two or more blocks of lines
  1243. X(e.g., procedures)
  1244. appear in a different order in two revisions.
  1245. An edit script derived from a longest common substring
  1246. first deletes the shorter of the two blocks, and then reinserts it.
  1247. Heckel\u12\d
  1248. proposed an algorithm for detecting block moves, but
  1249. since the algorithm is based on heuristics,
  1250. there are conditions
  1251. under which the generated delta is far from minimal.
  1252. DSEE uses this algorithm combined with blank compression,
  1253. apparently with satisfactory overall results.
  1254. A new algorithm that is guaranteed to produce a minimal delta based on
  1255. block moves appears in Reference 13.
  1256. A future release of RCS will use this algorithm.
  1257. X.PP
  1258. X\fIAcknowledgements\fR:
  1259. Many people have helped make RCS a success by contributed criticisms, suggestions,
  1260. corrections, and even whole new commands (including manual pages).
  1261. The list of people is too long to be
  1262. reproduced here, but my sincere thanks for their help and
  1263. goodwill goes to all of them.
  1264. X.sp
  1265. X.nr VS 12p
  1266. X.vs 12p
  1267. X.SH
  1268. Appendix: Synopsis of RCS Operations
  1269. X.LP
  1270. X.IP "\fIci\fP \fB\- check in revisions\fP"
  1271. X.sp 0
  1272. X\fICi\fR stores the contents of a working file into the
  1273. corresponding RCS file as a new revision.
  1274. If the RCS file doesn't exist, \fIci\fR creates it.
  1275. X\fICi\fR removes the working file, unless one of the options
  1276. X\fI\-u\fR or \fI\-l\fR is present.
  1277. XFor each check-in, \fIci\fR asks for a commentary
  1278. describing the changes relative to the previous revision.
  1279. X.sp 1
  1280. X\fICi\fR assigns the revision number given by the \fI\-r\fR option;
  1281. if that option is missing, it derives the number from the
  1282. lock held by the user; if there is no lock and locking is not strict,
  1283. X\fIci\fR increments the number of the latest revision on the trunk.
  1284. A side branch can only be started by explicitly specifying its
  1285. number with the \fI\-r\fR option during check-in.
  1286. X.sp 1
  1287. X\fICi\fR also determines
  1288. whether the revision to be checked in is different from the
  1289. previous one, and asks whether to proceed if not.
  1290. This facility simplifies check-in operations for large systems,
  1291. because one need not remember which files were changed.
  1292. X.sp 1
  1293. The option \fI\-k\fR searches the checked in file for identification
  1294. markers containing
  1295. the attributes
  1296. revision number, check-in date, author and state, and assigns these
  1297. to the new revision rather than computing them.  This option is
  1298. useful for software distribution: Recipients of distributed software
  1299. using RCS should check in updates with the \fI\-k\fR option.
  1300. This convention guarantees that revision numbers, check-in dates,
  1301. etc., are the same at all sites.
  1302. X.IP "\fIco\fP \fB\- check out revisions\fP"
  1303. X.sp 0
  1304. X\fICo\fR retrieves revisions according to revision number,
  1305. date, author and state attributes.  It either places the revision
  1306. into the working file, or prints it on the standard output.
  1307. X\fICo\fR always expands the identification markers.
  1308. X.IP "\fIident\fP \fB\- extract identification markers\fP"
  1309. X.sp 0
  1310. X\fIIdent\fR extracts the identification markers expanded by \fIco\fR
  1311. from any file and prints them.
  1312. X.IP "\fIrcs\fP \fB\- change RCS file attributes\fP"
  1313. X.sp 0
  1314. X\fIRcs\fR is an administrative operation that changes access lists,
  1315. locks, unlocks, breaks locks, toggles the strict-locking feature,
  1316. sets state attributes and symbolic revision numbers, changes the
  1317. description, and deletes revisions.  A revision can
  1318. only be deleted if it is not the fork of a side branch.
  1319. X.IP "\fIrcsclean\fP \fB\- clean working directory\fP"
  1320. X.sp 0
  1321. X.ne 10
  1322. X\fIRcsclean\fR removes working files that were checked out but never changed.*
  1323. X.FS *
  1324. The \fIrcsclean\fP and \fIrcsfreeze\fP commands
  1325. are optional and are not always installed.
  1326. X.FE
  1327. X.IP "\fIrcsdiff\fP \fB\- compare revisions\fP"
  1328. X.sp 0
  1329. X\fIRcsdiff\fR compares two revisions and prints their
  1330. difference, using the UNIX tool \fIdiff\fR.
  1331. One of the revisions compared may be checked out.
  1332. This command is useful for finding out about changes.
  1333. X.IP "\fIrcsfreeze\fP \fB\- freeze a configuration\fP"
  1334. X.sp 0
  1335. X\fIRcsfreeze\fR assigns the same symbolic revision number
  1336. to a given revision in all RCS files.
  1337. This command is useful for accurately recording a configuration.*
  1338. X.IP "\fIrcsmerge\fP \fB\- merge revisions\fP"
  1339. X.sp 0
  1340. X\fIRcsmerge\fR merges two revisions, \fIrev1\fR and \fIrev2\fR,
  1341. with respect to a common ancestor.
  1342. A 3-way file comparison determines the segments of lines that
  1343. are (a) the same in all three revisions, or (b) the same in 2 revisions,
  1344. or (c) different in all three.  For all segments of type (b) where
  1345. X\fIrev1\fR is the differing revision,
  1346. the segment in \fIrev1\fR replaces the corresponding segment of \fIrev2\fR.
  1347. Type (c) indicates an overlapping change, is flagged as an error, and requires user
  1348. intervention to select the correct alternative.
  1349. X.IP "\fIrlog\fP \fB\- read log messages\fP"
  1350. X.sp 0
  1351. X\fIRlog\fR prints the log messages and other information in an RCS file.
  1352. X.bp
  1353. X.LP
  1354. X.nr VS 12p
  1355. X.vs 12p
  1356. X.]<
  1357. X.ds [F 1
  1358. X.]-
  1359. X.ds [K FELD02
  1360. X.ds [K MakeArticle
  1361. X.ds [A Feldman, Stuart I.
  1362. X.ds [D March 1979
  1363. X.ds [T Make\*-A Program for Maintaining Computer Programs
  1364. X.ds [J Software\*-Practice & Experience
  1365. X.ds [V 9
  1366. X.ds [N 3
  1367. X.ds [P 255-265
  1368. X.nr [P 1
  1369. X.nr [T 0
  1370. X.nr [A 1
  1371. X.nr [O 0
  1372. X.][ 1 journal-article
  1373. X.ds [F 2
  1374. X.]-
  1375. X.ds [K HUNT01
  1376. X.ds [T An Algorithm for Differential File Comparison
  1377. X.ds [A Hunt, James W.
  1378. X.as [A " and McIlroy, M. D.
  1379. X.ds [I Computing Science Technical Report, Bell Laboratories
  1380. X.ds [R 41
  1381. X.ds [D June 1976
  1382. X.nr [T 0
  1383. X.nr [A 1
  1384. X.nr [O 0
  1385. X.][ 4 tech-report
  1386. X.ds [F 3
  1387. X.]-
  1388. X.ds [K SCCS
  1389. X.ds [A Rochkind, Marc J.
  1390. X.ds [D Dec. 1975
  1391. X.ds [T The Source Code Control System
  1392. X.ds [J IEEE Transactions on Software Engineering
  1393. X.ds [V SE-1
  1394. X.ds [N 4
  1395. X.ds [P 364-370
  1396. X.nr [P 1
  1397. X.nr [T 0
  1398. X.nr [A 1
  1399. X.nr [O 0
  1400. X.][ 1 journal-article
  1401. X.ds [F 4
  1402. X.]-
  1403. X.ds [K TICH08
  1404. X.ds [T Design, Implementation, and Evaluation of a Revision Control System
  1405. X.ds [A Tichy, Walter F.
  1406. X.ds [B Proceedings of the 6th International Conference on Software Engineering
  1407. X.ds [I ACM, IEEE, IPS, NBS
  1408. X.ds [D September 1982
  1409. X.ds [P 58-67
  1410. X.nr [P 1
  1411. X.nr [T 0
  1412. X.nr [A 1
  1413. X.nr [O 0
  1414. X.][ 3 article-in-book
  1415. X.ds [F 5
  1416. X.]-
  1417. X.ds [K LEBL01
  1418. X.ds [A Leblang, David B.
  1419. X.as [A " and Chase, Robert P.
  1420. X.ds [T Computer-Aided Software Engineering in a Distributed Workstation Environment
  1421. X.ds [O Proceedings of the ACM SIGSOFT/SIGPLAN Software Engineering Symposium
  1422. X.as [O " on Practical Software Development Environments.
  1423. X.ds [J SIGPLAN Notices
  1424. X.ds [V 19
  1425. X.ds [N 5
  1426. X.ds [D May 1984
  1427. X.ds [P 104-112
  1428. X.nr [P 1
  1429. X.nr [T 0
  1430. X.nr [A 1
  1431. X.nr [O 0
  1432. X.][ 1 journal-article
  1433. X.ds [F 1
  1434. X.ds [F 3
  1435. X.ds [F 6
  1436. X.]-
  1437. X.ds [K SCCSEval
  1438. X.ds [A Glasser, Alan L.
  1439. X.ds [D Nov. 1978
  1440. X.ds [T The Evolution of a Source Code Control System
  1441. X.ds [J Software Engineering Notes
  1442. X.ds [V 3
  1443. X.ds [N 5
  1444. X.ds [P 122-125
  1445. X.nr [P 1
  1446. X.ds [O Proceedings of the Software Quality and Assurance Workshop.
  1447. X.nr [T 0
  1448. X.nr [A 1
  1449. X.nr [O 1
  1450. X.][ 1 journal-article
  1451. X.ds [F 5
  1452. X.ds [F 7
  1453. X.]-
  1454. X.ds [K IBMClearCaster
  1455. X.ds [A Brown, H.B.
  1456. X.ds [D 1970
  1457. X.ds [T The Clear/Caster System
  1458. X.ds [J Nato Conference on Software Engineering, Rome
  1459. X.nr [T 0
  1460. X.nr [A 1
  1461. X.nr [O 0
  1462. X.][ 1 journal-article
  1463. X.ds [F 3
  1464. X.ds [F 8
  1465. X.]-
  1466. X.ds [K HabermannSDC
  1467. X.ds [A Habermann, A. Nico
  1468. X.ds [D Jan. 1979
  1469. X.ds [T A Software Development Control System
  1470. X.ds [I Technical Report, Carnegie-Mellon University, Department of Computer Science
  1471. X.nr [T 0
  1472. X.nr [A 0
  1473. X.nr [O 0
  1474. X.][ 2 book
  1475. X.ds [F 9
  1476. X.]-
  1477. X.ds [K CMS
  1478. X.ds [A DEC
  1479. X.ds [T Code Management System
  1480. X.ds [I Digital Equipment Corporation
  1481. X.ds [O Document No.\ EA-23134-82
  1482. X.ds [D 1982
  1483. X.nr [T 0
  1484. X.nr [A 0
  1485. X.nr [O 0
  1486. X.][ 2 book
  1487. X.ds [F 10
  1488. X.]-
  1489. X.ds [K LAMP01
  1490. X.ds [A Lampson, Butler W.
  1491. X.as [A " and Schmidt, Eric E.
  1492. X.ds [T Practical Use of a Polymorphic Applicative Language
  1493. X.ds [B Proceedings of the 10th Symposium on Principles of Programming Languages
  1494. X.ds [I ACM
  1495. X.ds [P 237-255
  1496. X.nr [P 1
  1497. X.ds [D January 1983
  1498. X.nr [T 0
  1499. X.nr [A 1
  1500. X.nr [O 0
  1501. X.][ 3 article-in-book
  1502. X.ds [F 5
  1503. X.ds [F 11
  1504. X.]-
  1505. X.ds [K TICH07
  1506. X.ds [T A Data Model for Programming Support Environments and its Application
  1507. X.ds [A Tichy, Walter F.
  1508. X.ds [B Automated Tools for Information System Design and Development
  1509. X.ds [E Hans-Jochen Schneider and Anthony I. Wasserman
  1510. X.ds [C Amsterdam
  1511. X.ds [I North-Holland Publishing Company
  1512. X.ds [D 1982
  1513. X.nr [T 0
  1514. X.nr [A 1
  1515. X.nr [O 0
  1516. X.][ 3 article-in-book
  1517. X.ds [F 4
  1518. X.ds [F 2
  1519. X.ds [F 12
  1520. X.]-
  1521. X.ds [K HECK01
  1522. X.ds [T A Technique for Isolating Differences Between Files
  1523. X.ds [A Heckel, Paul
  1524. X.ds [J Communications of the ACM
  1525. X.ds [D April 1978
  1526. X.ds [V 21
  1527. X.ds [N 4
  1528. X.ds [P 264-268
  1529. X.nr [P 1
  1530. X.nr [T 0
  1531. X.nr [A 0
  1532. X.nr [O 0
  1533. X.][ 1 journal-article
  1534. X.ds [F 13
  1535. X.]-
  1536. X.ds [K TICH11
  1537. X.ds [T The String-to-String Correction Problem with Block Moves
  1538. X.ds [A Tichy, Walter F.
  1539. X.ds [D Nov. 1984
  1540. X.ds [J ACM Transactions on Computer Systems
  1541. X.ds [V 2
  1542. X.ds [N 4
  1543. X.ds [P 309-321
  1544. X.nr [P 1
  1545. X.nr [T 0
  1546. X.nr [A 1
  1547. X.nr [O 0
  1548. X.][ 1 journal-article
  1549. X.]>
  1550. END_OF_FILE
  1551. if test 56906 -ne `wc -c <'rcs.ms'`; then
  1552.     echo shar: \"'rcs.ms'\" unpacked with wrong size!
  1553. fi
  1554. # end of 'rcs.ms'
  1555. fi
  1556. echo shar: End of archive 9 \(of 11\).
  1557. cp /dev/null ark9isdone
  1558. MISSING=""
  1559. for I in 1 2 3 4 5 6 7 8 9 10 11 ; do
  1560.     if test ! -f ark${I}isdone ; then
  1561.     MISSING="${MISSING} ${I}"
  1562.     fi
  1563. done
  1564. if test "${MISSING}" = "" ; then
  1565.     echo You have unpacked all 11 archives.
  1566.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1567. else
  1568.     echo You still need to unpack the following archives:
  1569.     echo "        " ${MISSING}
  1570. fi
  1571. ##  End of shell archive.
  1572. exit 0
  1573.